﻿using Microsoft.Practices.Unity;

namespace Zuehlke.Blueprint.Quickstart.Architecture.Launcher.Extensions
{
    /// <summary>
    /// Extension methods for <see cref="IUnityContainer"/> objects.
    /// </summary>
    public static class UnityContainerExtensions
    {
        /// <summary>
        /// Registers a type as singleton.
        /// </summary>
        public static void RegisterSingleton<TInterface, TType>(this IUnityContainer container)
            where TType : TInterface
        {
            container.RegisterType(typeof(TInterface), typeof(TType), new ContainerControlledLifetimeManager());
        }
    }
}
